package com.warm.base.design.b_memento.black;

/**
 * @Date: 2019/11/28 10:00
 * @Author: LChuang
 * @Description:
 */
public class BOriginator {

    public String state;

    public String getState(){
        return state;
    }

    public void setState(String state){
        this.state = state;
        System.out.println("赋值状态: " + state);
    }

    public BMemento createBMemento(){
        return new BMemento(this);
    }

    public void restoreBMemento(IMemento memento){
        this.state = ((BMemento) memento).getState();
    }

    @Override
    public String toString() {
        return "BOriginator{" +
                "state='" + state + '\'' +
                '}';
    }
}
